package cn.iocoder.yudao.framework.business.basic.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Objects;
import java.util.stream.Stream;

/**
 * <pre>
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 *  全局角色编码枚举
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 * </pre>
 *
 * @author 山野羡民（1032694760@qq.com）
 * @see cn.iocoder.yudao.framework.common.biz.permission.enums.RoleCodeEnum
 * @since 2024/12/04
 */
@RequiredArgsConstructor
@Getter
public enum RoleCodeV2Enum implements EnumCodable {

    UNKNOWN("", "未知"),
    SUPER_ADMIN("super_admin", "超级管理员"),
    TENANT_ADMIN("tenant_admin", "租户管理员"),
    PLATFORM_ADMIN("platform_admin", "平台管理员"),
    GUEST("guest", "游客"),
    SHOP_ADMIN("shop_admin", "店铺管理员"),
    ;

    private final String code;
    private final String name;

    public static RoleCodeV2Enum codeOf(String code) {
        return Stream.of(values())
                .filter(p -> Objects.equals(p.code, code))
                .findAny()
                .orElse(UNKNOWN);
    }

}
